<template>
  <view v-if="vipTwoDeco.id && !isReviewMode" class="deco-person-vip-bar" @click="handleOpenVip">
    <image v-if="userInfo.level !== '2'" class="w-full" :src="useImage('/zuimei-film-oss/1.0.0/images/person-vip-bar.png')" mode="widthFix"></image>
    <view v-else class="relative">
      <image class="vip-bar" :src="useImage('/zuimei-film-oss/1.0.0/images/person-vip-after-bar.png')" mode="widthFix"></image>
      <view class="vip-validity">会员有效期至{{ userInfo.vipCardList.endTime | formatDate }}</view>
    </view>
  </view>
</template>

<script>
import mixin from "@/decoration/mixins"
import { mapGetters } from "vuex"
export default {
  name: "deco-person-vip-bar",
  mixins: [mixin],
  data() {
    return {}
  },
  computed: {
    ...mapGetters(["vipTwoDeco", "userInfo", "isReviewMode"])
  },
  methods: {
    handleOpenVip() {
      uni.$toView({
        url: "pages/member/vip-equity-detail/vip-equity-detail",
        params: {
          vipLevel: 1
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.deco-person-vip-bar {
  padding-top: 24px;
  .vip-bar {
    width: 100%;
  }
  .vip-validity {
    position: absolute;
    color: #ecd6b5;
    left: 32rpx;
    bottom: 45rpx;
  }
}
</style>
